package cn.webrx;

public class Str7 {
    public static void main(String[] args) {
        //查检子串
        String s = "hello6 java计pc算机";
        System.out.println(s.contains("javascript"));
        System.out.println(s.contains("计算"));
        if(s.contains("6")) {

        }else{

        }


        //.indexOf(97) 'a'
        System.out.println("hello6 java计pc算6机".indexOf("6",9));
        System.out.println("hello6 java计pc算6机".indexOf("666"));
        System.out.println("hello6 java计pc算6机".lastIndexOf("6"));


        String fp = "d:\\user\\shop\\0610\\xywrwerwz.jpg".toUpperCase();
        //获取目录 d:/user/shop/0610/
        System.out.println(fp.substring(0,fp.lastIndexOf('\\')));


        //获取文件名 xyz.jpg
        System.out.println("abc".substring(1, 2));
        System.out.println("abc".substring(1));

        //获取扩展名 .jpg
        System.out.println(fp.toLowerCase().substring(fp.lastIndexOf(".")+1));


        //"".endsWith()
        System.out.println("java ".endsWith("a"));
        //"".startsWith()
        System.out.println("javascript".toLowerCase().startsWith("JAVA".toLowerCase()));
    }
}
